package org.example.prototype;

public class Rectangle implements Shape {
    private String color;
    private int width;
    private int height;

    public Rectangle(String color, int width, int height) {
        this.color = color;
        this.width = width;
        this.height = height;
    }

    @Override
    public void draw() {
        System.out.println("绘制矩形: 颜色=" + color + ", 宽=" + width + ", 高=" + height);
    }

    @Override
    public Shape clone() {
        try {
            return (Shape) super.clone(); // 浅拷贝
        } catch (CloneNotSupportedException e) {
            return null;
        }
    }

    // 设置方法
    public void setColor(String color) {
        this.color = color;
    }

    public void setSize(int width, int height) {
        this.width = width;
        this.height = height;
    }
}